
<ul class="nav nav-tabs">
	<li class="active"><a href="./index.php?action=module&do=rule&m={$_SESSION['p']}&op=display">管理{$module['title']}</a></li>
	<li><a href="./index.php?action=module&do=rule&m={$_SESSION['p']}&op=post"><i class="fa fa-plus"></i> 添加{$module['title']}</a></li>
</ul>
<div class="clearfix">
	<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
				<div class="form-group">
					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">关键词</label>
					<div class="col-sm-8 col-xs-12">
							<input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
					</div>
					<div class="col-xs-12 col-sm-2 col-lg-1 text-right">
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<form onsubmit="return false" action="./index.php?action=module&do=rule&op=delete" method="post" class="form-horizontal" role="form" id="form1">
	{if !empty($replies)}
	<div>
		{loop $replies $row}
		<div class="panel panel-default">
			<div class="panel-body">
				<span class="label label-default" data-toggle="tooltip" data-placement="top" title="{if $kw['type']==1}等于{elseif $kw['type']==2}包含{elseif $kw['type']==3}正则{/if}">{$row['keyword']}</span>&nbsp;
			</div>
			<div class="panel-footer clearfix">
				<div class="btn-group pull-right">
					<a class="btn btn-default btn-sm" href="./index.php?action=module&do=rule&op=post&rid={$row['id']}"><i class="fa fa-edit"></i> 编辑</a>
					<a class="btn btn-default btn-sm" href="./index.php?action=module&do=rule&op=delete&rid={$row['id']}" onclick="return confirm('删除规则将同时删除关键字与回复，确认吗？');return false;"><i class="fa fa-times"></i> 删除</a>
				</div>
			</div>
		</div>
		{/loop}
	</div>
	<div>
		<label class="checkbox-inline" style="margin-top:-30px;margin-left:17px"><input type="checkbox" name="select_all" id="select_all" value="1"/></label>
		<input type="submit" class="btn btn-danger" value="删除" onclick="if(!confirm('确定删除选中的规则吗？')) return false;"/>
		<input type="hidden" name="token" value="{$_AR['token']}"/>
	</div>
	{/if}
	</form>
	{$pager}
</div>
<script>
require(['bootstrap'], function($){
	$(function () {
		$('[data-toggle="tooltip"]').tooltip();
		$('#select_all').click(function(){
			$('#form1 :checkbox').prop('checked', $(this).prop('checked'));
		});
		$('#form1 :checkbox').click(function(){
			if(!$(this).prop('checked')) {
				$('#select_all').prop('checked', false);
			} else {
				var flag = 0;
				$('#form1 :checkbox[name="rid[]"]').each(function(){
					if(!$(this).prop('checked') && !flag) {
						flag = 1;
					}
				});
				if(flag) {
					$('#select_all').prop('checked', false);
				} else {
					$('#select_all').prop('checked', true);
				}
			}
		});
	})
});
</script>

